<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>文章列表</title>
    <base href="<?php echo base_url();?>">
    <script type="text/javascript" src="./style/admin/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="./style/admin/js/public.js"></script>
    <link rel="stylesheet" href="./style/admin/css/public.css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $('.del').click(function () {
                if (confirm('是否删除？') == false){
                    return;
                }
                var aid = $(this).parent().parent().children('#aid').text();
                $.ajax({
                    type:'post',
                    url:'./admin/article/del.html',
                    async:true,
                    dataType:'json',
                    data:{
                        aid:aid
                    },
                    success:function (data) {
                        if (data.code == 'ok'){
                            window.location.reload();
                            return;
                        }
                        if (data.msg){
                            alert(data.msg);
                        }
                    },
                    error:function (xhr, status, msg) {
                        alert(msg);
                    }
                });
            });
        });
    </script>
</head>
<body>
<table class="table">
    <tr class="th">
        <td>编号</td>
        <td>标题</td>
        <td>类型</td>
        <td>栏目</td>
        <td>时间</td>
        <td colspan="2">操作</td>
    </tr>
    <?php foreach($article_list as $row): ?>
    <tr>
        <td id="aid"><?php echo $row['aid']; ?></td>
        <td><?php echo $row['title']; ?></td>
        <td><?php echo $row['type']; ?></td>
        <td><?php echo $row['cname']; ?></td>
        <td><?php echo date('Y-m-d', $row['time']); ?></td>
        <td align="center"><button class="input_button edit_button">编辑</button></td>
        <td align="center"><button type="button" class="input_button del">删除</button></td>
    </tr>
    <?php endforeach ?>
</table>
<div class="page">
    <?php echo $links;?>
</div>

</body>
</html>